import {requestDelete, requestGet, requestPost, requestPut} from "@/api";

export const getPipelineList = () => {
    return requestGet('/api/pm/pipelines')
}

export const getPipelineById = (id:string) => {
    return requestGet('/api/pm/pipeline/'+id)
}

export const getWebhooksByPipelineId = (id:string) => {
    return requestGet('/api/pm/pipeline/'+id+ "/webhooks")
}

export const savePipeline = (data?:any) => {
    return requestPost("/api/pm/pipeline",data)
}

export const updatePipeline = (data?:any) => {
    return requestPut("/api/pm/pipeline",data)
}
export const deletePipeline = (id:string) => {
    return requestDelete("/api/pm/pipeline/"+id)
}

export const getVariablesByPipelineId = (id:string) => {
    return requestGet('/api/pm/pipeline/'+id+ "/variables")
}

export const switchPipelineEnabled = (id:string) => {
    return requestGet('/api/pm/pipeline/'+id + "/switch")
}
// export const useOrgApi = (id: Number) => {
// 	return service.get('/pm/org/' + id)
// }
//
// export const deleteApi = (id?:string) => {
// 	return service.get('/pm/org/delete/' + id)
// }
//
// export const useOrgSubmitApi = (dataForm: any) => {
// 	if (dataForm.id) {
// 		return service.post('/pm/org/save', dataForm)
// 	} else {
// 		return service.post('/pm/org/save', dataForm)
// 	}
// }
